<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="../../static/bootstrap/css/bootstrap.min.css"
        th:href="@{~/static/bootstrap/css/bootstrap.min.css}" />
    <link rel="stylesheet" href="../../static/css/patient.css" th:href="@{~/static/css/patient.css}" />
    <link rel="stylesheet" href="../../static/css/global.css" th:href="@{~/static/css/global.css}" />
    <title>药房配药页</title>
</head>

<body>
    <!-- 弹窗组件 -->
    <div th:replace="~{reuse/alertBox::alertBox}"></div>
    <!-- 头部固定导航栏 -->
    <div th:replace="~{homepageFD::doctorHomeNav}"></div>
    <main class="mainBox">
        <div class="container shadow-md-sm">
            <section th:switch="${#maps.isEmpty(map)}">
                <div th:case="false">
                    <div th:each="map : ${map}"
                        class="border border-success-subtle rounded mb-3 p-3 shadow-sm text-center">
                        <div>挂诊号：[[${map.key}]]</div>
                        <div th:each="list : ${map.value}">
                            <span>[[${list.name}]]，</span>
                            <span>[[${list.amount}]]份，</span>
                            <span>[[${list.frequency}]]，</span>
                            <span>[[${list.comment}]]</span>
                        </div>
                        <button class="btn btn-outline-success btn-sm"
                            th:onclick="finishMedicine([[${map.key}]])">配药完毕且已领取</button>
                    </div>
                </div>
                <div th:case="true" class="text-center">暂无工作</div>
            </section>
        </div>
    </main>
    <script th:src="@{~/static/bootstrap/js/bootstrap.bundle.min.js}"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script th:inline="javascript">
        const finishMedicine = (key) => {
            $.ajax({
                type: "POST",
                url: "/doctor/medicine/getMedinice",
                data: key,
                dataType: "json",
                contentType: "application/json;charset=utf-8",
            }).done(function(){
                location.reload();
            })
        }
    </script>
    <script type="text/javascript"> </script>
</body>

</html>